﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using YasharEl.Infrastructure.Core.Commenting;
using YasharEl.Infrastructure.Core.Users;

namespace YasharEl.Infrastructure.Core.EntityModel.Commenting
{
    public abstract class AbstractCommentEntity : Entity, IComment
    {
        #region Fields

        private DateTime _createdDate;
        private IUser _createdBy;

        #endregion

        #region IComment Properties

        public virtual DateTime CreatedDate
        {
            get
            {
                return _createdDate;
            }
            protected set
            {
                _createdDate = value;
            }
        }

        public virtual IUser CreatedBy
        {
            get
            {
                return _createdBy;
            }
            protected set
            {
                _createdBy = value;
            }
        }

        public virtual long CommentId
        {
            get;
            set;
        }

        public virtual string Text
        {
            get;
            set;
        }

        public virtual bool IsRead { get; set; }

        #endregion

        #region Abstract Properties

        public abstract ICommentable CommentedEntity
        {
            get;
            protected set;
        }

        public abstract CommentType CommentType
        {
            get;
            set;
        }

        #endregion

        #region AbstractEntity<long> Overrides

        public override long Id
        {
            get
            {
                return CommentId;
            }
            protected set
            {
                CommentId = value;
            }
        }

        #endregion
    }
}
